BEGIN {
    # define the score ranges
    split("0 60 70 80 90", start)
    split("59.999 69.999 79.999 89.999 100", end)
    for (i = 1; i <= 5; i++) {
        bucket[i] = ""
    }
}

# classify every record
{
    score = $3 + 0          # force numeric
    if(score == 0) {
    } else {
    for (i = 1; i <= 5; i++) {
        if (score >= start[i] && score <= end[i]) {
            bucket[i] = bucket[i] $0 "\n"
            break
        }
    }
    }
}

END {
    for (i = 1; i <= 5; i++) {
        # build a temp array with the lines of this bucket
        n = split(bucket[i], lines, "\n")
        # # shuffle the array (Fisher-Yates)
        # for (j = n; j > 1; j--) {
        #     r = int(rand() * j) + 1
        #     tmp = lines[j]; lines[j] = lines[r]; lines[r] = tmp
        # }
        # print at most 3 lines from this bucket
        limit = (n > 3) ? 3 : n
        for (k = 1; k <= limit; k++) {
            print lines[k]
        }
        # print "#---------\n"
    }
}